package unit10;

import java.io.RandomAccessFile;

public class Demo01 {

    //使用RandomAccessFile流将javaProjectAllWork/src/unit10/log.txt目录中的log.txt文件倒置打印输出
    public static void main(String args[]) throws Exception {
        RandomAccessFile raf = new RandomAccessFile("javaProjectAllWork/src/unit10/log.txt", "r");
        long len = raf.length();
        long pos = len - 1;
        byte[] buf = new byte[1];
        while (pos >= 0) {
            raf.seek(pos);
            raf.read(buf);
            System.out.print(new String(buf));
            pos--;
        }
        raf.close();
    }



}
